<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:insert="fragments/head">

</head>
<body>
<header th:insert="fragments/header">
</header>

<main>
    <div class="container">
        <div class="row mt-3">
            <!-- Sidebar -->
            <div class="col s12 m4">
                <div class="container">
                    <img th:if="${student.id_student}" class="responsive-img circle z-depth-3" th:src="${student.imgurl}">
                    <img th:unless="${student.id_student}" class="responsive-img circle z-depth-3" src="/img/instructors/instructor-stock.png">
                </div>
                <ul class="collapsible z-depth-3 mt-3">
                    <li>
                        <div class="collapsible-header"><i class="material-icons">assignment_ind
                        </i><span>Especialidad</span></div>
                        <div class="collapsible-body"><span th:text="${student.descStudent}">Descripcion del
                            student</span></div>
                    </li>
                    <li>
                        <div class="collapsible-header"><i class="material-icons">drafts</i>Correo</div>
                        <div class="collapsible-body"><span th:text="${student.correoStudent}">Correo del student</span></div>
                    </li>
                </ul>
            </div>
            <!-- Student Details -->
            <div class="col s12 m8">
                <div class="card z-depth-3">
                    <div class="card-content teal lighten-2 white-text">
                        <span class="card-title"><strong
                                th:text="${student.nomStudent} + ' ' + ${student.apeStudent}"></strong>
                        <span sec:authorize="hasRole('ROLE_ADMIN')">
                                    <a th:href="@{/students/edit/{id_student}
                                    (id_student=${student.id_student})}"
                                       class="btn-floating waves-effect waves-light btn-small yellow darken-1"><i
                                            class="material-icons">edit</i>
                                    </a>
                                    </span>
                        </span>
                        <p th:if="${student.detalleStudent}">
                            <span th:text="${student.detalleStudent}">Detalle</span>
                            <a sec:authorize="hasRole('ROLE_ADMIN')" class="btn-floating btn-small red lighten-1 waves-effect waves-light modal-trigger" href="#modal-detalle"><i class="material-icons">edit</i></a>
                        </p>
                        <!-- Modal Trigger -->
                        <p th:unless="${student.detalleStudent}">
                            <a class="btn-floating btn-small red lighten-1 modal-trigger waves-effect waves-light" href="#modal-detalle"><i class="material-icons">add</i></a>
                        </p>
                    </div>
                    <!-- Modal Sctructure -->
                    <div id="modal-detalle" class="modal">
                        <form th:action="@{/students/patch/{id_student} (id_student=${student.id_student})}" th:object="${student}" method="post">

                            <div class="modal-content">
                                <h4 class="teal-text">Cuéntanos sobre ti</h4>
                                <div class="input-field">
                                    <label for="detalle-student">Detalle</label>
                                    <textarea th:field="*{detalleStudent}" id="detalle-student" class="materialize-textarea"></textarea>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <a href="#!" class="modal-close waves-effect waves-red btn-flat red-text">Cancelar</a>
                                <button type="submit" class="modal-close waves-effect waves-green btn-flat teal-text">
                                    Confirmar</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>
<br><br>
<footer class="page-footer teal" th:insert="fragments/footer">

</footer>

<!--  Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="/js/materialize.js"></script>
<script src="/js/init.js"></script>

</body>
</html>